<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMessageTable extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('message',function(Blueprint $table){
            $table->increments('id');                                //消息标识
            $table->string('content')->nullable();                   //消息内容
            $table->string('type')->nullable();                      //消息类型
            $table->unsignedInteger('user_id')->nullable();     //发起者id
            $table->unsignedInteger('to_user_id')->nullable();       //获取者id
            $table->integer('is_read');                              //判断是否已读
            $table->unsignedInteger('to_msg_id')->nullable();        //回复上级消息
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('message') ;
    }

}
